Skip to content

Conversation

nvlsianpu
Copy link
Contributor

@nvlsianpu nvlsianpu commented Sep 5, 2025

Added infrastructure needed for redirect execution to the Application reset vector in case SoC gets woke-up from S2RAM and MCUboot is the first code entity. Thanks to that bootloader can implement its own routine for resume support (CONFIG_SOC_NRF54H20_PM_S2RAM_OVERRIDE) which overrides zephyr/soc/nordic/nrf54h/pm_s2ram.c implementation in case of MCUboot.

Introduce additional source of true using additional check over independent source (variable with magic value).

@nvlsianpu nvlsianpu marked this pull request as draft September 5, 2025 16:16
@nvlsianpu nvlsianpu force-pushed the nrf54h20_pm_s2ram_redirect branch 2 times, most recently from 02dd577 to 215d162 Compare September 9, 2025 15:34
@nvlsianpu nvlsianpu changed the title Nrf54h20 pm s2ram redirect nRF54h20 pm s2ram resume redirect (bootloader -> App) Sep 9, 2025
@nvlsianpu nvlsianpu marked this pull request as ready for review September 9, 2025 15:42
@nvlsianpu nvlsianpu force-pushed the nrf54h20_pm_s2ram_redirect branch from 215d162 to 123e125 Compare September 9, 2025 15:55
@nvlsianpu nvlsianpu added this to the 3.2.0-preview1 milestone Sep 15, 2025
@nordicjm
Copy link
Contributor

why can this upstream fix not be used zephyrproject-rtos/zephyr#95914 and why does this need noups?

@nvlsianpu
Copy link
Contributor Author

@nordicjm The upstream PR you mentioned is bugfix for another S2RAm related Issue.
This PR implements new scheme of resume form S2RAM sleep.

Copy link
Contributor

@nordicjm nordicjm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be moved into sdk-nrf rather than being a noup, the original file can be marked as a header only file which means it will not be compiled - see https://github.com/nrfconnect/sdk-nrf/blob/main/tests/subsys/net/lib/nrf_cloud/cloud/CMakeLists.txt#L40 for an example of how to do that, you can then substitute in a modified file to be compiled in place of it


config SOC_NRF54H20_PM_S2RAM_OVERRIDE
bool "Override `pm_s2ram` implementation"
default n
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default n

…plementation

Add Kconfig entries to allow compile own s2ram implementation.

Signed-off-by: Karol Lasończyk <[email protected]>
Signed-off-by: Andrzej Puzdrowski <[email protected]>
Added support for hardening decision on resume from
S2RAM by MCUboot bootloader.
Application sets additional variable to MCUBOOT_S2RAM_RESUME_MAGIC
which allows the bootloader to doublecheck.

Signed-off-by: Andrzej Puzdrowski <[email protected]>
@nvlsianpu nvlsianpu force-pushed the nrf54h20_pm_s2ram_redirect branch from 67af6a3 to d652dcd Compare September 15, 2025 13:16
@nordicjm
Copy link
Contributor

in future when opening PRs to sdk-mcuboot/sdk-zephyr and you are creating your own manifest PR then put manifest-pr-skip in the body so it doesn't automatically create a manifest that uses CI resources

/ {
soc {
/* run-time common mcuboot S2RAM support section */
mcuboot_s2ram: cpuapp_s2ram@22007fdc {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having a look at the sdk-mcuboot PR this is basically completely duplicating retention's boot mode feature, any reason that wasn't used given it already has checksum/header validity and is already supported by mcuboot/doesn't need duplicate maintenance?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason are that it is not another boot. From application execution it is perceived as resume from very deep sleep. Operation must be quick and low level. It must use limited resources. This section is for anty-glitch magic value recommended by Architect group. It is used for double check decision.

@carlescufi carlescufi merged commit 08e0cf4 into nrfconnect:main Sep 16, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants